<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <style>
        h3 {
            display: block;
            margin-block-start: 5px;
            margin-block-end: 5px;
            margin-inline-start: 0px;
            margin-inline-end: 0px;
            font-weight: bold;
        }

        h4 {
            display: block;
            margin-block-start: 10px;
            margin-block-end: -6px;
            margin-inline-start: 0px;
            margin-inline-end: 0px;
            font-weight: bold;
        }


        .table-c table {
            border-right: 1px solid;
            border-bottom: 1px solid
        }

        .table-c table td {
            border-left: 1px solid;
            border-top: 1px solid;
            width: 300px;
        }

        .table-c table td div {
            height: 250px;
            overflow-y: scroll;
        }

    </style>


    <script type="application/javascript">
        //https://emcharts.dfcfw.com/libs/jquery.1.12.4.js
        var timeLen = 5000;//每次定时时间 单位毫秒
        var kNum = 10;//多少次定时更新一下列表  10次就是上面的10倍
        var kFenText = timeLen * kNum / 60000;
        var nowDay = "";
        var secIdPub = "0.";
        var markerArr = [];
        var k = 0;

        function loadingHtml() {


            var data = {};
            data.code = "300059";
            data.secId = secIdPub;
            data.title = "东方财富";
            data.muBiaoJia = 22.00;
            markerArr[0]=data;


            var data1 = {};
            data1.code = "000001";
            data1.secId =  "1.";
            data1.title = "上证指数";
            data1.muBiaoJia = 3157;
            markerArr[1]=data1;

            var data2 = {};
            data2.code = "000016";
            data2.secId =  "1.";
            data2.title = "上证50";
            data2.muBiaoJia = 2713;
            markerArr[2]=data2;


            var data3 = {};
            data3.code = "300841";
            data3.secId =  secIdPub;
            data3.title = "康华生物";
            data3.muBiaoJia = 100;
            markerArr[3]=data3;

            console.log(markerArr);

            getCurrentDate();
            map_load();
            var t2 = window.setInterval(function () {
                map_load();
                //console.log('每隔1秒钟执行一次')
                if (k == kNum) {
                    k = 1;
                } else {
                    k++;
                }
            }, timeLen)

        }

        function delScript() {
            var scripts = document.getElementsByTagName("script");
            for (var i = 0; i < scripts.length; i++) {
                scripts[i].parentNode.removeChild(scripts[i]);
            }
        }

        function map_load() {


            for (var i = 0; i < markerArr.length; i++) {
                delScript();
                var load = document.createElement("script");

                var secid = markerArr[i].secId;
                var showName = "jQueryShow20";

                load.src = "https://push2.eastmoney.com/api/qt/stock/get?ut=fa5fd1943c7b386f172d6893dbfba10b&fltt=2&invt=2&fields=f43,f57,f58,f169,f170,f46,f44,f51,f168,f47,f164,f163,f116,f60,f45,f52,f50,f48,f167,f117,f71,f161,f49,f530,f135,f136,f137,f138,f139,f141,f142,f144,f145,f147,f148,f140,f143,f146,f149,f55,f62,f162,f92,f173,f104,f105,f84,f85,f183,f184,f185,f186,f187,f188,f189,f190,f191,f192,f107,f111,f86,f177,f78,f110,f262,f263,f264,f267,f268,f250,f251,f252,f253,f254,f255,f256,f257,f258,f266,f269,f270,f271,f273,f274,f275,f127,f199,f128,f193,f196,f194,f195,f197,f80,f280,f281,f282,f284,f285,f286,f287,f292&secid=" + secid +""+ markerArr[i].code + "&cb=" + showName + "&_=" + new Date().getTime();


                document.body.appendChild(load);
            }
            createMingxiTable( );
        }

        function jQueryShow20(result) {
            showMingxiTable(result);
        }




        function showMingxiTable(result) {
            // <tr><td>名称</td><td>最新价</td><td>涨幅</td><td>目标价</td><td>距目标价</td></tr>

            var data = result.data;
            console.log(result);
            var f57 = data.f57;

            var markerDate;
            for (var i = 0; i < markerArr.length; i++) {
                if (markerArr[i].code == f57) {
                    markerDate = markerArr[i];
                }
            }

            var f43 = data.f43;
            var f170 = data.f170;

            var mingxiTr = document.getElementById('mingxiTr'+f57);
            var tr ="<td>"+markerDate.title+"</td><td>"+ f43+"</td><td>"+f170 + "%"+"</td><td>"+markerDate.muBiaoJia+"</td><td>"+(markerDate.muBiaoJia-f43).toFixed(2)+"</td>";

            mingxiTr.innerHTML =tr;
        }


        function createMingxiTable( ) {
            var mingxiTable = document.getElementById('mingxiTable');
            var html= '<tr><td>名称</td><td>最新价</td><td>涨幅</td><td>目标价</td><td>距目标价</td></tr>';
            for (var i = 0; i < markerArr.length; i++) {
                var code=markerArr[i].code;
                html = html+'<tr id="mingxiTr'+code+'"></tr>';
            }
            mingxiTable.innerHTML =html;
        }







        function getCurrentDate() {
            nowDay = getNow();
        }

        function getNow() {
            var now = new Date();
            var year = now.getFullYear(); //得到年份
            var month = now.getMonth();//得到月份
            var date = now.getDate();//得到日期
            var day = now.getDay();//得到周几
            var hour = now.getHours();//得到小时
            var minu = now.getMinutes();//得到分钟
            var sec = now.getSeconds();//得到秒
            var MS = now.getMilliseconds();//获取毫秒
            var week;
            month = month + 1;
            if (month < 10) month = "0" + month;
            if (date < 10) date = "0" + date;
            if (hour < 10) hour = "0" + hour;
            if (minu < 10) minu = "0" + minu;
            if (sec < 10) sec = "0" + sec;
            if (MS < 100) MS = "0" + MS;
            //time = year + "年" + month + "月" + date + "日" + " " + hour + ":" + minu + ":" + sec + " " + week;
            return year + "-" + month + "-" + date;
        }

        function getNowMiao() {
            var now = new Date();
            var year = now.getFullYear(); //得到年份
            var month = now.getMonth();//得到月份
            var date = now.getDate();//得到日期
            var day = now.getDay();//得到周几
            var hour = now.getHours();//得到小时
            var minu = now.getMinutes();//得到分钟
            var sec = now.getSeconds();//得到秒
            var MS = now.getMilliseconds();//获取毫秒
            var week;
            month = month + 1;
            if (month < 10) month = "0" + month;
            if (date < 10) date = "0" + date;
            if (hour < 10) hour = "0" + hour;
            if (minu < 10) minu = "0" + minu;
            if (sec < 10) sec = "0" + sec;
            if (MS < 100) MS = "0" + MS;
            //time = year + "年" + month + "月" + date + "日" + " " + hour + ":" + minu + ":" + sec + " " + week;
            return hour + ":" + minu + ":" + sec;
        }


        function getQueryVariable(variable) {
            var query = window.location.search.substring(1);
            var vars = query.split("&");
            for (var i = 0; i < vars.length; i++) {
                var pair = vars[i].split("=");
                if (pair[0] == variable) {
                    return pair[1];
                }
            }
            return (false);
        }
    </script>

<body onload="loadingHtml()">


<div class="table-c" style="max-width: 600px;">
    <table id="mingxiTable">
        <tr><td>名称</td><td>最新价</td><td>涨幅</td><td>目标价</td><td>距目标价</td></tr>
    </table>

</div>

</body>
</html>